/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var fieldLabel = new Array('测点名称','测点类型','安装位置','装置厂家',
                            '状态','上次心跳时间','缺失数据时间','缺失数据类型','上次校验日期');
var fieldName=new Array("name","pointType",'installSite','manufactoryName','status',"lastHBTime",'defectDataTime',"defectDataTpye",
                        "checkTime",'rn');
var _pageSize=20;

var centerstore=new Ext.data.JsonStore({               
    //data: [
    //       ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17']
    //]
    url: "../../servlet/report/gridvoltagepoint",
    root: 'data',
    idProperty: 'id',
    totalProperty: 'count',
    fields: fieldName,
    autoLoad: true
});

var checkboxSel = new Ext.grid.CheckboxSelectionModel();

var centercolumnModel = new Ext.grid.ColumnModel({
    columns: [
        checkboxSel,
    {header: '序号',width: 40, dataIndex: 'rn', align: 'center'},    
    {header: fieldLabel[0],width: 100, dataIndex: fieldName[0], align: 'center'},
    {header: fieldLabel[1],width: 100, dataIndex: fieldName[1], align: 'center'},
    {header: fieldLabel[2],width: 100, dataIndex: fieldName[2], align: 'center'},
    {header: fieldLabel[3],width: 100, dataIndex: fieldName[3], align: 'center'},
    {header: fieldLabel[4],width: 100, dataIndex: fieldName[4], align: 'center'},
    {header: fieldLabel[5],width: 100, dataIndex: fieldName[1], align: 'center'},
    {header: fieldLabel[6],width: 100, dataIndex: fieldName[2], align: 'center'},
    {header: fieldLabel[7],width: 100, dataIndex: fieldName[3], align: 'center'},
    {header: fieldLabel[8],width: 100, dataIndex: fieldName[4], align: 'center'},
    ],
    defaultSortable: true
  
});

var grid=new Ext.grid.GridPanel({
    title: '补采5分钟数据',
    store: centerstore,
    sm: checkboxSel,
    colModel:centercolumnModel,
    enableColumnMove: false,
    viewConfig: {
        forceFit: true
    },
    loadMask: true,
    
    tbar: new Ext.Toolbar([
        pointTypeCombo,
        '-',
        pointText,
        searchButton,
        {
            xtype: 'button',
            text: '补采',
            iconCls: 'icon-search',
            width: 60,
            style: {marginLeft: '20px'},
            handler: Supplement
        }
    ]),
    bbar: new Ext.PagingToolbar({
        pageSize: _pageSize,
        store: centerstore,
        displayInfo: true,
        displayMsg: '显示记录：{0} - {1}   总记录：{2}',
        emptyMsg:  '目前没有信息'
    })
});
centerstore.load({
    params: {
        start: 0, 
        limit: _pageSize
    }
})
//补采函数
function Supplement(){
    
}
function buildWindow(){
    var applicationUI = new Ext.Viewport({
        layout:'fit',
        items: [
        grid
        ]
    });
}
Ext.onReady(buildWindow); 
